package com.example.android_demo2.workmanager

import android.content.Context
import androidx.work.Worker
import androidx.work.WorkerParameters

class SleepWorker(context: Context, parameters: WorkerParameters) : Worker(context, parameters) {

    override fun doWork(): Result {
        val sleepDuration = inputData.getLong(SLEEP_DURATION, 1000)
        Thread.sleep(sleepDuration)
//        delay(sleepDuration)
        return Result.success()
    }


    companion object {
        const val SLEEP_DURATION = "SLEEP_DURATION"
    }

}